home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 25 / CU Amiga Magazine's Super CD-ROM 25 (1998)(EMAP Images)(GB)(Track 1 of 2)[!][issue 1998-08].iso / CUCD / Programming / GMS / GMSDev / Includes / graphics / blitter.i < prev    next >
Encoding:
Text File  |  1998-05-07  |  12.3 KB  |  345 lines

  1.     IFND GRAPHICS_BLITTER_I
  2. GRAPHICS_BLITTER_I SET  1
  3.  
  4. **
  5. **  $VER: blitter.i V1.0
  6. **
  7. **  Blitter Module Definitions
  8. **
  9. **  (C) Copyright 1996-1998 DreamWorld Productions.
  10. **      All Rights Reserved.
  11. **
  12.  
  13.     IFND    DPKERNEL_I
  14.     include 'dpkernel/dpkernel.i'
  15.     ENDC
  16.  
  17. *****************************************************************************
  18. * Module definitions.
  19.  
  20. BlitModVersion  = 1
  21. BlitModRevision = 0
  22.  
  23. *****************************************************************************
  24. * Pixel definitions.
  25.  
  26.    STRUCTURE    PXL,00
  27.     WORD    PXL_XCoord
  28.     WORD    PXL_YCoord
  29.     LONG    PXL_Colour
  30.     LABEL    PXL_SIZEOF
  31.  
  32. PIXEL    MACRO
  33.     dc.w    \1,\2
  34.     dc.l    \3
  35.     ENDM
  36.  
  37. SKIPPIXEL =    -32000
  38.  
  39. *****************************************************************************
  40. * Bitmap structure, used for blitting.
  41.  
  42. VER_BITMAP  = 1
  43. TAGS_BITMAP = (ID_SPCTAGS<<16)|ID_BITMAP
  44.  
  45.    STRUCTURE    BMP1,HEAD_SIZEOF ;[00] Standard header.
  46.     APTR    BMP_Data         ;[12] Pointer to bitmap data area.
  47.     WORD    BMP_Width        ;[16] Width.
  48.     WORD    BMP_ByteWidth    ;[18] ByteWidth.
  49.     WORD    BMP_Height       ;[20] Height.
  50.     WORD    BMP_Type         ;[22] Type.
  51.     LONG    BMP_LineMod      ;[24] Line differential.
  52.     LONG    BMP_PlaneMod     ;[28] Plane differential.
  53.     APTR    BMP_Parent       ;[32] Bitmap owner.
  54.     APTR    BMP_Restore      ;[36] Restore list for this bitmap, if any.
  55.     LONG    BMP_Size         ;[40] Total size of the bitmap in bytes.
  56.     LONG    BMP_MemType      ;[44] Memory type to use in allocation.
  57.     WORD    BMP_Planes       ;[48] Amount of planes.
  58.     WORD    BMP_resEmpty     ;[50] Reserved.
  59.     LONG    BMP_AmtColours   ;[52] Maximum amount of colours available.
  60.     APTR    BMP_Palette      ;[56] Pointer to the Bitmap's palette.
  61.     LONG    BMP_Flags        ;[60] Optional flags.
  62.  
  63. BMA_Data       = (TAPTR|BMP_Data)
  64. BMA_Width      = (TWORD|BMP_Width)
  65. BMA_Height     = (TWORD|BMP_Height)
  66. BMA_Type       = (TWORD|BMP_Type)
  67. BMA_Size       = (TLONG|BMP_Size)
  68. BMA_MemType    = (TLONG|BMP_MemType)
  69. BMA_Planes     = (TWORD|BMP_Planes)
  70. BMA_AmtColours = (TLONG|BMP_AmtColours)
  71. BMA_Palette    = (TAPTR|BMP_Palette)
  72. BMA_Flags      = (TLONG|BMP_Flags)
  73.  
  74. *****************************************************************************
  75. * Bitmap types (for BMP_Type).
  76.  
  77. INTERLEAVED = 1           ;Interleaved (2 ... 256 colours)
  78. ILBM        = INTERLEAVED ;Short synonym of Interleaved.
  79. PLANAR      = 2           ;Planar (2 ... 256 colours)
  80. CHUNKY8     = 3           ;Chunky 8 bit (256 colours)
  81. CHUNKY16    = 4           ;Chunky 16 bit (65535 colours)
  82. TRUECOLOUR  = 5           ;True colour (16 million colours)
  83.  
  84. *****************************************************************************
  85. * Bitmap flags (for BMP_Flags).
  86.  
  87. BMF_BLANKPALETTE = $00000001  ;For a blank (black) palette.
  88. BMF_EXTRAHB      = $00000002  ;Extra half brite.
  89. BMF_HAM          = $00000004  ;HAM mode.
  90.  
  91. ****************************************************************************
  92.  
  93. PALETTE_ARRAY = ((ID_PALETTE<<16)|01)
  94.  
  95. *****************************************************************************
  96. * The RestoreList structure.
  97.  
  98. VER_RESTORE  = 1
  99. TAGS_RESTORE = (ID_SPCTAGS<<16)|ID_RESTORE
  100.  
  101.     STRUCTURE    RH1,HEAD_SIZEOF
  102.     WORD    RH_Buffers       ;Amount of screen buffers
  103.     WORD    RH_Entries       ;Amount of entries.
  104.     APTR    RH_Owner         ;Owner of the restorelist, ie bitmap.
  105.  
  106.     *** Private fields below ***
  107.  
  108.     APTR    RH_List1
  109.     APTR    RH_List2
  110.     APTR    RH_List3
  111.     APTR    RH_ListPos1
  112.     APTR    RH_ListPos2
  113.     APTR    RH_ListPos3
  114.     LABEL    RH_SIZEOF
  115.  
  116. RSA_Buffers = (TWORD|RH_Buffers)
  117. RSA_Entries = (TWORD|RH_Entries)
  118. RSA_Owner   = (TAPTR|RH_Owner)
  119.  
  120.     *** Private Structure ***
  121.  
  122.     STRUCTURE    RSE,0
  123.     APTR    RSE_Next         ;Next restore entry in the chain.
  124.     APTR    RSE_Prev         ;Previous restore enty in the chain.
  125.     APTR    RSE_Bob          ;Bob structure belonging to the restore [*]
  126.     APTR    RSE_Address      ;Screen pointer (top of screen) [*]
  127.     LABEL    RSE_Mask         ;Pointer to the bob's mask [Label *]
  128.     APTR    RSE_Storage      ;Background storage or NULL.
  129.     APTR    RSE_Control      ;Controls from the lookup table.
  130.     APTR    RSE_ConMask      ;The control mask to use.
  131.     WORD    RSE_Modulo1      ;Modulo C
  132.     LONG    RSE_Modulo2      ;Modulos A/D.
  133.     LABEL    RSE_BlitSize     ;[Label *]
  134.     WORD    RSE_BlitWidth    ;[*]
  135.     WORD    RSE_BlitHeight   ;[*]
  136.     LABEL    RSE_SIZEOF
  137.  
  138. *****************************************************************************
  139. * Bob structure, also used as a skeleton for Mbob's.
  140.  
  141. VER_BOB  =  1
  142. TAGS_BOB =  (ID_SPCTAGS<<16)|ID_BOB
  143.  
  144.     STRUCTURE    BOB1,HEAD_SIZEOF
  145.     APTR    BOB_emp1           ;...
  146.     APTR    BOB_emp2           ;...
  147.     APTR    BOB_GfxCoords      ;Pointer to frame list for graphics [R:W]
  148.     WORD    BOB_Frame          ;Current frame [R:W]
  149.     WORD    BOB_emp3           ;...
  150.     WORD    BOB_Width          ;Width in pixels (true width) [R:I]
  151.     WORD    BOB_ByteWidth      ;Width in bytes (round up) [R]
  152.     WORD    BOB_XCoord         ;X coordinate [R:W]
  153.     WORD    BOB_YCoord         ;Y coordinate [R:W]
  154.     WORD    BOB_Height         ;Height in pixels [R:I]
  155.     WORD    BOB_ClipLX         ;Left X border in bytes.
  156.     WORD    BOB_ClipTY         ;Top Y border.
  157.     WORD    BOB_ClipRX         ;Right X border in bytes.
  158.     WORD    BOB_ClipBY         ;Bottom Y border.
  159.     WORD    BOB_FPlane         ;First plane to blit to (planar only) [R:I]
  160.     WORD    BOB_Planes         ;Amount of planes [R:I]
  161.     WORD    BOB_PropHeight     ;Expected height of source bitmap.
  162.     WORD    BOB_PropWidth      ;Expected width of source bitmap.
  163.     WORD    BOB_Buffers        ;Amount of buffers in dest screen [O:R]
  164.     LONG    BOB_PlaneSize      ;Size of a single plane (planar only) [R]
  165.     LONG    BOB_Attrib         ;Attributes like CLIP and MASK.
  166.     APTR    BOB_SrcBitmap      ;Source Bitmap.
  167.     WORD    BOB_Empty          ;Reserved (in use by MBob).
  168.     WORD    BOB_emp4           ;...
  169.     APTR    BOB_Source         ;Pointer to bob source (origin).
  170.     APTR    BOB_DirectGfx      ;Pointer to direct frame list [R]
  171.     APTR    BOB_DestBitmap     ;Destination Bitmap [R]
  172.     APTR    BOB_MaskCoords     ;Pointer to frame list for masks [R:I]
  173.     APTR    BOB_DirectMasks    ;Pointer to direct frame list [R]
  174.     APTR    BOB_MaskBitmap     ;Source Bitmap for masks.
  175.     WORD    BOB_AmtFrames      ;Total amount of frames in GfxCoords.
  176.  
  177.     *** Private fields start now ***
  178.  
  179.     WORD    BOB_StoreSize      ;4/8/12 Sizeof one store entry (MBob's)
  180.     APTR    BOB_StoreBuffer    ;A/B/C [0/4/8] storage pointer (MBob's)
  181.     WORD    BOB_StoreMax       ;Maximum store position.
  182.     APTR    BOB_StoreMemory    ;Master storage pointer (for the freemem).
  183.     WORD    BOB_StoreCount     ;Counter for store, 0, 4, 8.
  184.     APTR    BOB_StoreA         ;Storage buffer 1.
  185.     APTR    BOB_StoreB         ;Storage buffer 2.
  186.     APTR    BOB_StoreC         ;Storage buffer 3.
  187.     APTR    BOB_DrawRoutine    ;Routine for drawing/clearing/storing.
  188.     APTR    BOB_ClearRoutine   ;Routine for clearing.
  189.     APTR    BOB_RestoreRoutine ;Routine for restoring/clearing.
  190.     APTR    BOB_HeightRoutine  ;Replaces BS_DrawRoutine for large heights.
  191.     LONG    BOB_ScreenSize     ;Size of destination plane.
  192.     WORD    BOB_Modulo         ;Bob Modulo (PicWidth-BobWidth)
  193.     WORD    BOB_MaskModulo     ;Mask Modulo (BobWidth-BobWidth for GENMASK).
  194.     APTR    BOB_MaskMemory     ;Master mask pointer (for the freemem).
  195.     WORD    BOB_MaxHeight      ;Maximum possible height, limited by blitter.
  196.     WORD    BOB_ScrLine        ;Size of a line (for interleaved).
  197.     WORD    BOB_BobLine        ;Size of a Bob line (Width*Planes)
  198.     WORD    BOB_MaskLine       ;Size of a Mask Line (Width*Planes)
  199.     WORD    BOB_TrueWidth      ;The true pixel width (++shift)
  200.     WORD    BOB_TrueBWidth     ;The true byte width (++shift)
  201.     WORD    BOB_TrueWWidth     ;The true word width (++shift)
  202.     WORD    BOB_ClipBLX        ;ClipLX, byte.
  203.     WORD    BOB_ClipBRX        ;ClipRX, byte.
  204.     LONG    BOB_Modulo1        ;Modulus. (C/B)
  205.     LONG    BOB_Modulo2        ;Modulus. (A/D)
  206.     LONG    BOB_NSModulo1      ;Modulus. (C/B)
  207.     LONG    BOB_NSModulo2      ;Modulus. (A/D)
  208.     WORD    BOB_WordWidth      ;The word width.
  209.     BYTE    BOB_AFlags         ;Allocation flags.
  210.     BYTE    BOB_Pad            ;
  211.     APTR    BOB_Screen         ;
  212.     APTR    BOB_MaskData       ;
  213.     WORD    BOB_SrcWidth       ;Source Page Width in bytes.
  214.     WORD    BOB_SrcMaskWidth   ;Mask Page Width in bytes.
  215.  
  216. BBA_Frame        = (TWORD|BOB_Frame)
  217. BBA_GfxCoords    = (TAPTR|BOB_GfxCoords)
  218. BBA_Width        = (TWORD|BOB_Width)
  219. BBA_Height       = (TWORD|BOB_Height)
  220. BBA_XCoord       = (TWORD|BOB_XCoord)
  221. BBA_YCoord       = (TWORD|BOB_YCoord)
  222. BBA_ClipLX       = (TWORD|BOB_ClipLX)
  223. BBA_ClipTY       = (TWORD|BOB_ClipTY)
  224. BBA_ClipRX       = (TWORD|BOB_ClipRX)
  225. BBA_ClipBY       = (TWORD|BOB_ClipBY)
  226. BBA_FPlane       = (TWORD|BOB_FPlane)
  227. BBA_Planes       = (TWORD|BOB_Planes)
  228. BBA_PropHeight   = (TWORD|BOB_PropHeight)
  229. BBA_PropWidth    = (TWORD|BOB_PropWidth)
  230. BBA_Buffers      = (TWORD|BOB_Buffers)
  231. BBA_Attrib       = (TLONG|BOB_Attrib)
  232. BBA_SrcBitmap    = (TAPTR|BOB_SrcBitmap)
  233. BBA_Source       = (TAPTR|BOB_Source)
  234. BBA_MaskCoords   = (TAPTR|BOB_MaskCoords)
  235. BBA_MaskBitmap   = (TAPTR|BOB_MaskBitmap)
  236.  
  237. BBA_SourceTags   = (TSTEPIN|TTRIGGER|BOB_Source)
  238. BBA_AmtPlanes    = BBA_Planes
  239.  
  240. *****************************************************************************
  241. * MBob structure for MBV1, based on BBV1.
  242.  
  243. VER_MBOB  =  1
  244. TAGS_MBOB =  (ID_SPCTAGS<<16)|ID_MBOB
  245.  
  246.     STRUCTURE    MBOB1,HEAD_SIZEOF
  247.     APTR    MB_emp1           ;...
  248.     APTR    MB_emp2           ;...
  249.     APTR    MB_GfxCoords      ;Pointer to frame list for graphics.
  250.     WORD    MB_AmtEntries     ;Amount of entries in the image list.
  251.     WORD    MB_emp3           ;...
  252.     WORD    MB_Width          ;Width in pixels.
  253.     WORD    MB_ByteWidth      ;Width in bytes.
  254.     APTR    MB_EntryList      ;Pointer to the entry/image list.
  255.     WORD    MB_Height         ;Height in pixels.
  256.     WORD    MB_ClipLX         ;Left X border in bytes.
  257.     WORD    MB_ClipTY         ;Top Y border.
  258.     WORD    MB_ClipRX         ;Right X border in bytes.
  259.     WORD    MB_ClipBY         ;Bottom Y border.
  260.     WORD    MB_FPlane         ;First plane to blit to (planar only)
  261.     WORD    MB_Planes         ;Amount of planes.
  262.     WORD    MB_PropHeight     ;Expected height of source picture.
  263.     WORD    MB_PropWidth      ;Expected width of source picture.
  264.     WORD    MB_Buffers        ;Amount of buffers in dest screen.
  265.     LONG    MB_PlaneSize      ;Size Of Plane Source (planar only)
  266.     LONG    MB_Attrib         ;Attributes like CLIP and MASK.
  267.     APTR    MB_SrcBitmap      ;Source Bitmap.
  268.     WORD    MB_EntrySize      ;Size of each entry.
  269.     WORD    MB_emp4           ;...
  270.     APTR    MB_Source         ;Pointer to source structure (bob origin).
  271.     APTR    MB_DirectGfx      ;Pointer to direct frame list.
  272.     APTR    MB_DestBitmap     ;Pointer to Bob's destination Bitmap.
  273.     APTR    MB_MaskCoords     ;Pointer to frame list for masks.
  274.     APTR    MB_DirectMasks    ;
  275.     APTR    MB_MaskBitmap     ;
  276.     WORD    MB_AmtFrames      ;Total amount of frames in frame/direct lists.
  277.  
  278.    STRUCTURE    BE,0              ;MBob Entry Structure.
  279.     WORD    BE_XCoord
  280.     WORD    BE_YCoord
  281.     UWORD    BE_Frame
  282.     LABEL    BE_SIZEOF
  283.  
  284. SKIPIMAGE =  32000
  285.  
  286. MBA_AmtEntries   = (TWORD|MB_AmtEntries)
  287. MBA_GfxCoords    = (TAPTR|MB_GfxCoords)
  288. MBA_Width        = (TWORD|MB_Width)
  289. MBA_Height       = (TWORD|MB_Height)
  290. MBA_EntryList    = (TAPTR|MB_EntryList)
  291. MBA_ClipLX       = (TWORD|MB_ClipLX)
  292. MBA_ClipTY       = (TWORD|MB_ClipTY)
  293. MBA_ClipRX       = (TWORD|MB_ClipRX)
  294. MBA_ClipBY       = (TWORD|MB_ClipBY)
  295. MBA_FPlane       = (TWORD|MB_FPlane)
  296. MBA_Planes       = (TWORD|MB_Planes)
  297. MBA_Attrib       = (TLONG|MB_Attrib)
  298. MBA_SrcBitmap    = (TAPTR|MB_SrcBitmap)
  299. MBA_EntrySize    = (TWORD|MB_EntrySize)
  300. MBA_Source       = (TAPTR|MB_Source)
  301. MBA_Buffers      = (TWORD|MB_Buffers)
  302. MBA_MaskCoords   = (TAPTR|MB_MaskCoords)
  303. MBA_PropWidth    = (TWORD|MB_PropWidth)
  304. MBA_PropHeight   = (TWORD|MB_PropHeight)
  305. MBA_MaskBitmap   = (TAPTR|MB_MaskBitmap)
  306.  
  307. *****************************************************************************
  308. * Drawing Methods and Options for both bob structures (BOB_Attrib).
  309.  
  310. B_CLIP     =     0       ;Allow border clipping.
  311. B_MASK     =     1       ;Allow masking.
  312. B_FILLMASK =    2       ;Fill any holes in the mask on generation.
  313. B_CLEAR    =    3       ;Allow automatic clearing.
  314. B_RESTORE  =    4       ;Allow automatic background restore.
  315. ;B_ = 5
  316. B_CLRMASK  =    6       ;Use masks in the clear.
  317. B_GENONLY  =    7       ;Create and use masks for drawing this bob.
  318.  
  319. BBF_CLIP     =  (1<<B_CLIP)
  320. BBF_MASK     =  (1<<B_MASK)
  321. BBF_FILLMASK =  (1<<B_FILLMASK)
  322. BBF_CLEAR    =  (1<<B_CLEAR)
  323. BBF_RESTORE  =  (1<<B_RESTORE)
  324. ; = 1<<
  325. BBF_CLRMASK  =  (1<<B_CLRMASK)
  326. BBF_GENONLY  =  (1<<B_GENONLY)
  327. BBF_GENMASKS =  (BBF_GENONLY|BBF_MASK)
  328.  
  329. BBF_CLRNOMASK = 0                ;Do not use masks in the clear (default).
  330. BBF_GENMASK   = BBF_GENMASKS     ;Synonym.
  331. BBF_FILLMASKS = BBF_FILLMASK     ;Synonym.
  332. BBF_GENFMASK  = (BBF_GENMASK|BBF_FILLMASK)
  333.  
  334. *****************************************************************************
  335.  
  336. BSORT_X         = $00000001
  337. BSORT_Y         = $00000002
  338. BSORT_DOWNTOP   = $00000004    ;From Bottom to top.
  339. BSORT_RIGHTLEFT = $00000008    ;Right to Left.
  340. BSORT_LEFTRIGHT = $00000000    ;Default.
  341. BSORT_TOPDOWN   = $00000000    ;Default.
  342.  
  343.  
  344.     ENDC    ;GRAPHICS_BLITTER_I
  345.